// 车辆管理

import request from '@/utils/request'

// 获取车辆类型分页数据
export function getCarListApi(
  page,
  pageSize,
  id,
  allowableLoad,
  name,
  allowableVolume
) {
  return request({
    url: `/truckType/page`,
    method: 'get',
    params: {
      page,
      pageSize,
      id,
      allowableLoad,
      name,
      allowableVolume
    }
  })
}

// 新增车辆
export function addCarApi(data) {
  return request({
    url: `/truckType`,
    method: 'post',
    data
  })
}

// 获取车辆类型详情
export function getCarDetailsApi(id) {
  return request({
    url: `/truckType/${id}`,
    method: 'get'
  })
}

// 更新车辆类型
export function editCarDetailsApi(id, data) {
  return request({
    url: `/truckType/${id}`,
    method: 'put',
    data
  })
}

// 删除车辆类型
export function delCarApi(id) {
  return request({
    url: `/truckType/${id}`,
    method: 'DELETE'
  })
}

// 获取车辆分页数据
export function getCarPageApi(
  page,
  pageSize,
  truckTypeId,
  licensePlate,
  workStatus
) {
  return request({
    url: `/truck/page`,
    method: 'get',
    params: {
      page,
      pageSize,
      truckTypeId,
      licensePlate,
      workStatus
    }
  })
}

// 获取车辆详情
export function getCarDetailApi(id) {
  return request({
    url: `/truck/${id}`,
    method: 'get'
  })
}

// 获取车辆行驶证详情
export function getCarRunApi(id) {
  return request({
    url: `/truck/${id}/license`,
    method: 'get'
  })
}

// 添加车辆
export function addCarGpsApi(data) {
  return request({
    url: `/truck`,
    method: 'POST',
    data
  })
}
